from langchain_core.beta.runnables.context import Context
from langchain_core.runnables.passthrough import RunnablePassthrough
from langchain_core.prompts.prompt import PromptTemplate
from langchain_core.output_parsers.string import StrOutputParser
from langchain.schema import HumanMessage, SystemMessage
from langchain_openai.chat_models import ChatOpenAI

from langchain.chat_models import init_chat_model

from langchain_core.messages import HumanMessage, SystemMessage


model = ChatOpenAI(
    model="deepseek-chat",
    temperature=0,
    openai_api_key="sk-605e60a1301040759a821b6b677556fb",
    base_url="https://api.deepseek.com/v1"
)
 

messages = [
    SystemMessage("Translate the following from English into Italian"),
    HumanMessage("hi!"),
]

from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate

from langchain.globals import set_verbose

StrOutputParser
from langchain.globals import set_debug

set_debug(True)
set_verbose(False)
 


rs=model.invoke(messages)
print(rs)



'''   
from langchain_core.prompts import ChatPromptTemplate

system_template = "Translate the following from English into {language}"

prompt_template = ChatPromptTemplate.from_messages(
    [("system", system_template), ("user", "{text}")]
)

prompt = prompt_template.invoke({"language": "Italian", "text": "hi!"})
print(prompt)





for token in model.stream(messages):
    print(token.content, end="|")


rs=model.invoke(messages)
print(rs)
'''


